﻿using System;
using System.Windows.Controls;

namespace Apps.Yunwei.Views
{
    public partial class AppPanel : UserControl
    {
        public AppPanel()
        {
            InitializeComponent();
        }

        private void ResumeEvent(bool result)
        {
            if (Done != null)
            {
                Done(this, new EditEventArgs() { Result = result });
            }
        }

        public event EventHandler<EditEventArgs> Done;

        private void ChoicePart()
        {
            new PartSelector() { DataContext = this.DataContext }.Show();
        }
        private void ChoiceColor(int mode)
        {
            new ColorSelector(mode) { DataContext = this.DataContext }.Show();
        }
        private void ChoiceImage()
        {
            new ImageSelector() { DataContext = this.DataContext, Source = "Icon1" }.Show();
        }

        private void ChoiceBackgroundColorClick(object sender, System.Windows.RoutedEventArgs e)
        {
            ChoiceColor(1);
        }
        private void ChoiceForegroundColorClick(object sender, System.Windows.RoutedEventArgs e)
        {
            ChoiceColor(2);
        }

        private void ChoicePartClick(object sender, System.Windows.RoutedEventArgs e)
        {
            ChoicePart();
        }

        private void ChoiceImageClick(object sender, System.Windows.RoutedEventArgs e)
        {
            ChoiceImage();
        }
    }

    public class EditEventArgs : EventArgs
    {
        public bool Result { get; set; }
    }
}